/**
 * @author   zhangyp
 * @created  2013-9-27 上午9:27:57
 * @email    zviolet@163.com
 * TODO      根据正则表达式来过滤文件名
 */
package bible.sunflower.util;

import java.io.File;
import java.io.FilenameFilter;
import java.util.regex.Pattern;

public class FilenameRegexFilter implements FilenameFilter {
	
	private Pattern p;

	public FilenameRegexFilter(String regex){
		p = Pattern.compile( regex );
	}
	
	@Override
	public boolean accept(File dir, String name) {
		return p.matcher( name ).matches();
	}

}
